/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */ 
package de.rockon.fuzzy.controller.model.helper;

import de.rockon.fuzzy.controller.model.FuzzySet;

public class Tupel implements Comparable<Tupel> {

	private double y;

	private FuzzySet set;

	public Tupel(double y, FuzzySet set) {
		super();
		this.y = y;
		this.set = set;
	}

	@Override
	public int compareTo(Tupel o) {
		if (getKey() < o.getKey()) {
			return -1;
		} else if (getKey() > o.getKey()) {
			return 1;
		} else {
			return hashCode() - o.hashCode();
		}
	}

	public double getKey() {
		return y;
	}

	public FuzzySet getValue() {
		return set;
	}

	@Override
	public String toString() {
		return "(" + y + "," + set.getName() + ")";
	}

}